home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5018 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.5 KB

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: IMPORTANT!!!!!!!!!!!!!!!!!!!!!
  5. Date: Fri, 02 Feb 1996 04:46:00 GMT
  6. Organization: Netcom
  7. Message-ID: <31118eca.8987840@nntp.ix.netcom.com>
  8. References: <4epb8s$9gp@reader2.ix.netcom.com> <311043bd.32347008@nntp.ix.netcom.com> <4er95j$5hh@cloner4.netcom.com>
  9. NNTP-Posting-Host: ix-dc7-19.ix.netcom.com
  10. X-NETCOM-Date: Thu Feb 01  8:46:40 PM PST 1996
  11. X-Newsreader: Forte Agent .99c/16.141
  12.  
  13. jeremyx@ix.netcom.com(Jeremy Johnston ) wrote:
  14.  
  15. > In <311043bd.32347008@nntp.ix.netcom.com> miker3@ix.netcom.com (Mike
  16. > Rubenstein) writes: 
  17. > >
  18. > >jeremyx@ix.netcom.com(Jeremy Johnston ) wrote:
  19. > >
  20. > >> 
  21. > >> 
  22. > >> 
  23. > >>         For some reason i can never get the \ to print! How do you
  24. > get
  25. > >> the \ to show up on the screen when you run the program?? 
  26. > >> 
  27. > >> ex:
  28. > >> 
  29. > >> 
  30. > >> printf(" i can never get the \ to print");
  31. > >> printf(" do you like dogs\cats?");
  32. > >> 
  33. > >>     after i compile the program & run it the "\" doesn'y show up?
  34. > >> please help!?
  35. > >> 
  36. > >
  37. > >In C++ literal strings, \ is an escape character.  You need something
  38. > >like
  39. > >
  40. > >    printf(" i can never get the \\ to print");
  41. > >    printf(" do you like dogs\\cats?");
  42. > >
  43. > >
  44. > >Michael M Rubenstein
  45. >  so your saying i just gotta make two of them & it will work?
  46.  
  47. In a literal, yes.  It's not a question of printing.  If you just use
  48. one \, it never gets put into the string.  If you put two adjacent \
  49. in a string literal, the resulting string contains 1 \.
  50.  
  51.  
  52. Michael M Rubenstein
  53.